import { addCollection } from '@iconify/vue';
import materialSymbols from '@iconify/json/json/material-symbols.json';
import antDesignIcons from '@iconify/json/json/ant-design.json';
import mdi from '@iconify/json/json/mdi.json';
import clarityIcons from '@iconify/json/json/clarity.json';
import codicon from '@iconify/json/json/codicon.json';
import ion from '@iconify/json/json/ion.json';
import eva from '@iconify/json/json/eva.json';

// 定义 IconifyJSON 类型（与官方类型一致）
interface IconifyJSON {
  prefix: string;
  icons: Record<
    string,
    {
      body: string;
      width?: number;
      height?: number;
    }
  >;
  width?: number;
  height?: number;
}

// 使支持图标离线也能显示
export function setupIcons(): void {
  addCollection(materialSymbols as IconifyJSON);
  addCollection(antDesignIcons as IconifyJSON);
  addCollection(clarityIcons as IconifyJSON);
  addCollection(mdi as IconifyJSON);
  addCollection(codicon as IconifyJSON);
  addCollection(ion as IconifyJSON);
  addCollection(eva as IconifyJSON);
}
